#include "comm.hpp"


int main()
{
    umask(0);
    int n = mkfifo(FIFO_FILE, 0666);
    if(n != 0)
    {
        perror("mkdir fifo error");
        exit(1);
    }
    int fd = open(FIFO_FILE, O_RDONLY);
    if(fd < 0)
    {
        perror("open file error");
        exit(1);
    }
    char buffer[1024];
    while(true){
        int n = read(fd, buffer, sizeof(buffer) - 1);
        if(n > 0)
        {
            buffer[n] = 0;
            std::cout << "client Say#" << buffer << std::endl;
        }
    }
    close(fd);
    return 0;
}